const express = require('express');
const router = express.Router();
const topicDao = require('../database/mysql/topicDao');
var writeEJS = require('./writeEJS');

router.get('/', async function (req, res, next) {
    if(req.session.userId == null){
        res.redirect('/');
        return
    }

    await writeEJS.asyncWriteHeader(req,res);

    let topic = await topicDao.getTopicByUserId(req.session.userId);
    res.locals.topic = topic;
    res.render('my_topicList');
})

module.exports = router